# $Id$
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: Alexander Baldeck <alexander@archlinux.org>

pkgname=xorg-xinit
pkgver=1.3.4
pkgrel=4
pkgdesc="X.Org initialisation program "
arch=('i686' 'x86_64')
license=('custom')
url="https://xorg.freedesktop.org/"
depends=('libx11' 'xorg-xauth' 'xorg-xrdb' 'xorg-xmodmap' 'inetutils')
makedepends=('xorg-util-macros')
optdepends=('xorg-twm' 'xterm')
backup=('etc/X11/xinit/xserverrc'
        'etc/X11/xinit/xinitrc')
source=(${url}/releases/individual/app/xinit-${pkgver}.tar.bz2{,.sig}
        06_move_serverauthfile_into_tmp.diff
        fs25361.patch
        fs46369.patch
        xserverrc)
options=(!emptydirs)
sha256sums=('75d88d7397a07e01db253163b7c7a00b249b3d30e99489f2734cac9a0c7902b3'
            'SKIP'
            'a5c6ced5822bbb3145e0f30a4b12995782ca6d80ff2d927851ec91b5e41212cb'
            '431335ceb84f75aaa96fba285a596f61a63629f94756f8063e4f621ae143629b'
            '6e2c44b997e604db167f00168e8b6c68257be50447d7a80856b4aa910f52351e'
            '86835010b5350c41035495b7b845db0eecf1e4b7eeaf152b12a881fa502e5387')
validpgpkeys=('7C2608F8E5F9E78D7A3F26FF177544B49AF313FB') #  "Hans de Goede <jwrdegoede@fedoraproject.org>"

prepare() {
  cd xinit-${pkgver}
  patch -Np1 -i ../06_move_serverauthfile_into_tmp.diff
  patch -Np1 -i ../fs25361.patch
  patch -Np1 -i ../fs46369.patch
  sed -i -e 's/XSLASHGLOB.sh/XSLASHGLOB/' xinitrc.cpp
}

build() {
  cd xinit-${pkgver}
  autoreconf -fi
  ./configure --prefix=/usr --with-xinitdir=/etc/X11/xinit
  make
}

package() {
  cd xinit-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -m644 "${srcdir}/xserverrc" "${pkgdir}/etc/X11/xinit/xserverrc"
  install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
  install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
}
